<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="./CSS/audio_control.css" />
<link type="text/css" href="CSS/smoothness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />	
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript">
$(function() {  
	// setup slider
	$( ".slider" ).each(function() {
		// read initial values from markup and remove that
		var value = parseInt( $( this ).text(), 10 );		
		$( this ).empty().slider({
			value: value,
			range: "min",
			min:0,
			max:100,
			animate: true,
			orientation: "vertical",
			slide: function( event, ui ) {
			 
			   $( "#"+$(this).attr("name")).val(ui.value );
		}
		});
	});
	
	$( "table  input[type=text]" ).each(function() {
			
			
		   var audiotxtid = $(this).attr("id");
		  
		   var value = $("#s"+audiotxtid).slider( "value");
			$(this).val(value);
		});
		
		
		
		$(".audiobutton").click(function(){

            
           var name =   $(this).attr("name");
		   var op= name.substring(8);

		   var audiotxt= name.substring(1,8);
		   alert(audiotxt);
		   var sid= name.substring(0,8);
		   
		   var value = $("#"+sid).slider( "value");
		   if(op =="+"){
             $("#"+sid).slider( "value",value+1);
			
             }
		   
		   
		   if(op=="-"){
            $("#"+sid).slider( "value",value-1);
			
              }
		     $( "#"+audiotxt).val($("#"+sid).slider( "value"));
           

     });
});


var   flag   =   1; 
function   changeStatus() 
{ 
      //    alert(flag);
        if   (flag   ==   1) 
        { 
               
			   
			   var isch = $("input[type=checkbox]:checked").val();
               if( isch ==undefined) 
              {

              alert("请选择切换音量通道");
              return
             }

     var strc= " ";
	 	$("input[type=checkbox]:checked").each(function(){
          strc += $(this).attr("name")+"= "+$("#"+$(this).attr("value")).slider( "value")+" ";
            })
			   $("#switchbutton1").css({
			    "borderLeftColor" :"#fff",
                "borderTopColor":"#fff", 
                "borderRightColor":"#fff",
                 "borderBottomColor":"#fff",
				}) ;
				
				$("#switchbutton1").attr("value","已切换至辅助输出");
                flag   =   0; 
				alert(strc+" 已切换");
        } 
        else 
        { 
		     
             $("input[type=checkbox]:checked").each(function(){
               $(this).attr("checked",false);
            })
			 $("#switchbutton1").css({
			    "borderLeftColor" :"#000",
                "borderTopColor":"#000", 
                "borderRightColor":"#000",
                 "borderBottomColor":"#000",
				}) ;
              $("#switchbutton1").attr("value","切换至辅助输出");
            
              flag   =   1; 
        }
		};

</script>	
</head>

<body>
<p id="text_area0">音量控制</p>
<div id="audio_control"> 
<table id="first" cellpadding="2px">
    <caption>立体声音量控制</caption>
    <tr>
        <th>音量1</th>
        <th>音量2</th>
    </tr>
    <tr>
        <td><input type="text" id="laudio1"   onfocus="this.blur()"/></td>
        <td><input type="text" id="laudio2"   onfocus="this.blur()" /></td>
    </tr>
    <tr>
        <td><input type="button" class="audiobutton"  name="slaudio1+"  value="+" /></td>
        <td><input type="button" class="audiobutton"  name="slaudio2+"   value="+"/></td>
    </tr>
	<tr>
        <td><div class="slider" id="slaudio1" name="laudio1">80</div></td>
        <td><div class="slider" id="slaudio2" name="laudio2">90</div></td>
    </tr>
	<tr>
        <td><input type="button" class="audiobutton"  name="slaudio1-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="slaudio2-" value="-"/></td>
    </tr>
    <tr> 
         <td class="color"><input name="lc1" type="checkbox" value="slaudio1" />确认</td>
         <td class="color"><input name="lc2" type="checkbox" value="slaudio2" />确认</td>
    </tr>
</table>
<table id="second" cellpadding="2px">
    <caption>单声道声音量控制</caption>
    <tr>
        <th>音量1</th>
        <th>音量2</th>
        <th>音量3</th>
        <th>音量4</th>
        <th>音量5</th>
        <th>音量6</th>
    </tr>
    <tr>
        <td><input type="text" id="daudio1"  onfocus="this.blur()" /></td>
        <td><input type="text" id="daudio2"  onfocus="this.blur()" /></td>
        <td><input type="text" id="daudio3"  onfocus="this.blur()" /></td>
        <td><input type="text" id="daudio4"  onfocus="this.blur()" /></td>
        <td><input type="text" id="daudio5"  onfocus="this.blur()" /></td>
        <td><input type="text" id="daudio6"  onfocus="this.blur()" /></td>
    </tr>
    <tr>
        <td><input type="button" class="audiobutton" name="sdaudio1+"  value="+" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio2+"  value="+"/></td>
        <td><input type="button" class="audiobutton"  name="sdaudio3+"  value="+"/></td>
        <td><input type="button" class="audiobutton"  name="sdaudio4+"  value="+"/></td>
        <td><input type="button" class="audiobutton"  name="sdaudio5+"  value="+"/></td>
        <td><input type="button" class="audiobutton"  name="sdaudio6+"  value="+"/></td>
    </tr>
	<tr>
        <td><div class="slider" id="sdaudio1" name="daudio1">20</div></td>
        <td><div class="slider" id="sdaudio2" name="daudio2">30</div></td>
        <td><div class="slider" id="sdaudio3" name="daudio3">40</div></td>
        <td><div class="slider" id="sdaudio4" name="daudio4">50</div></td>
        <td><div class="slider" id="sdaudio5" name="daudio5">60</div></td>
        <td><div class="slider" id="sdaudio6" name="daudio6">70</div></td>
    </tr>
	<tr>
        <td><input type="button" class="audiobutton"  name="sdaudio1-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio2-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio3-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio4-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio5-" value="-" /></td>
        <td><input type="button" class="audiobutton"  name="sdaudio6-" value="-" /></td>
    </tr>
    <tr> 
         <td class="color"><input name="dc1" type="checkbox" value="sdaudio1" />确认</td>
         <td class="color"><input name="dc2" type="checkbox" value="sdaudio2" />确认</td>
         <td class="color"><input name="dc3" type="checkbox" value="sdaudio3" />确认</td>
         <td class="color"><input name="dc4" type="checkbox" value="sdaudio4" />确认</td>
         <td class="color"><input name="dc5" type="checkbox" value="sdaudio5" />确认</td>
         <td class="color"><input name="dc6" type="checkbox" value="sdaudio6" />确认</td>
    </tr>
</table>
<table id="third">
    <tr>
         <td><input  id= "switchbutton1" class="color"  name="b1" type="button" value="切换至辅助输出" onclick= "changeStatus()"/></td>
    </tr>
    <tr>
         <td><div><br /><a href="equalizer.html" target="showframe">均衡设置</a></div></td>
    </tr>
</table>
<table id="four" cellpadding="3px">
    <caption>主输出</caption>
    <tr>
        <th>L</th>
        <th>R</th>
    </tr>
	<tr>
	<td><input type="text" id="zaudio1"   onfocus="this.blur()"/></td>
    <td><input type="text" id="zaudio2"   onfocus="this.blur()" /></td>
	</tr>
    <tr>
        <td><input type="button" class="audiobutton" name="szaudio1+"  value="+" /></td>
        <td><input type="button" class="audiobutton" name="szaudio2+"  value="+"/></td>
    </tr>
	<tr>
        <td><div class="slider" id="szaudio1" name="zaudio1">85</div></td>
        <td><div class="slider" id="szaudio2" name="zaudio2">86</div></td>
    </tr>
	<tr>
        <td><input type="button" class="audiobutton" name="szaudio1-"  value="-" /></td>
        <td><input type="button" class="audiobutton" name="szaudio2-"  value="-" /></td>
    </tr>
</table>
<table id="five" cellpadding="3px">
    <caption class="color">辅助输出</caption>
    <tr>
        <th>音量</th>
    </tr>
	<tr>
	<td><input type="text" id="faudio1"   onfocus="this.blur()"/></td>
    </tr>
    <tr>
        <td><input type="button" class="audiobutton" name="sfaudio1+"   value="+" /></td>
    </tr>
	<tr>
        <td><div class="slider" id="sfaudio1" name="faudio1">89</div></td>
    </tr>
	<tr>
        <td><input type="button" class="audiobutton" name="sfaudio1-"  value="-" /></td>
    </tr>
</table>
</div>
</body>
</html>
